Component({
  mixins: [],
  data: {
		animation:'',
		// bg:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN013QJC7L20xZqe73wrg_!!4161056916.png'
		// },
		// bg2:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01rzwBTH20xZqf5uYnP_!!4161056916.png'
		// },

		// seeShopImg:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01S0990J20xZqpRtYQE_!!4161056916.png'
		// },

		// random:{
		// 	url:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01CIwY2f20xZqoC16Dl_!!4161056916.png'
		// },

		// againImg:{
		// 	url:'https://img.alicdn.com/imgextra/i2/4161056916/O1CN01QPaYRx20xZqnuFX0Q_!!4161056916.png'
		// },

		// listImg:{
		// 	url:'https://img.alicdn.com/imgextra/i4/4161056916/O1CN01WK3h1A20xZqfz7xJB_!!4161056916.png'
		// },

		endPrizeNum:false
  },
  props: {
		popData:'',
		activityInfo:''
	},
	
	onInit(){

    this.setData({
      ...getApp().pifu.gameResultVictory,
    })

		this.isEndPrizeNum()
	},

  didMount() {

    console.info('组件接受的数据',this.props.popData)

    this.animation = my.createAnimation();

    this.animation.translate('0%','150%').step()
    this.setData({ animation: this.animation.export() });

    

  },
  didUpdate() {},
  didUnmount() {},
  methods: {

		isEndPrizeNum(){
			getApp().cloud.application.httpRequest({
      'path' : '/api/c/task/viewIsFinish', 
      'method':'POST',
      'headers':{ "Content-Type":"application/json"},
      'params':{},
      'body':{
				level:this.props.popData.levelInfo.difficulty
			},
      'exts':{}  }).then(res => {
				
				console.info('==============>>>>>>>>>',res)

				if(res.code != 200){
					my.showToast({
						content:res.msg
					});
					return
				}



				this.setData({
					endPrizeNum:!res.data
				})
			})
		},

		

    closeList(){
      
      this.animation.translate('0%','-150%').step()
      this.setData({ animation: this.animation.export() })

      setTimeout(() => {
        this.$page.setData({
          isScroll:false,
          isShowGameResultPopVictory:false
        })
      }, 400);
    },

    list(){
      // this.$page.setData({
      //   isShowList:true
			// })
			
			this.$page.showList()
    },

    goShop(){

			console.info(this.props.popData)

      my.tb.openDetail ({
        itemId: this.props.popData.levelInfo.productId.toString(),
        success: (res) => {
          //浏览商品种草
					this.$page.viewProduct(this.props.popData.levelInfo.difficulty);
					
					setTimeout(() => {
						this.isEndPrizeNum()
					}, 600);
        }
      });
    },

    again(){

      this.animation.translate('0%','-150%').step()
      this.setData({ animation: this.animation.export() })

      setTimeout(() => {
        this.$page.startGame()

        this.$page.setData({
          isShowGameResultPopVictory:false
        })
      }, 400);
      
      
    },

    //用户点击奖励
    prizeClick(){
      if(this.props.popData.prizeLog && this.props.popData.prizeLog.prizeType == 1){
        this.$page.gress()
      }
    },

  },
});